Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use packer plugins install --path to install (development version) #131

Merged
merged 1 commit into from
Mar 15, 2024

Conversation

torarnv
Copy link
Contributor

@torarnv torarnv commented Mar 11, 2024

With modern Packer, and Packer templates with required_plugins sections, the plugins need to follow a specific folder structure and also come with a sha256 hash of the plugin.

By using packer plugins install --path we can let Packer deal with the specifics of installing a plugin from disk instead of from a repository.

@torarnv
Copy link
Contributor Author

torarnv commented Mar 12, 2024

Need to tweak this a bit, hold on :)

@edigaryev
Copy link
Contributor

Should we just update the GNUmakefile to have the same contents as it has in the scaffolding template (except for NAME and BINARY variables)?

@torarnv
Copy link
Contributor Author

torarnv commented Mar 12, 2024

That would also work yepp :)

It doesn't have an install rule though, which would be nice to have, and the install rule shouldn't do go build -ldflags="-X '${PLUGIN_FQN}/version.VersionPrerelease=dev'" -o ${BINARY}.

One other thing I had to do was to update our version in version/version.go. I don't know if there's a way to keep it up to date whenever we tag/create new releases?

@torarnv
Copy link
Contributor Author

torarnv commented Mar 12, 2024

One missing piece here is that Packer doesn't easily allow you to run a Packer template with required_plugins against a dev/pre-release version: hashicorp/packer#12749 (comment)

With modern Packer, and Packer templates with required_plugins
sections, the plugins need to follow a specific folder structure
and also come with a sha256 hash of the plugin.

By using `packer plugins install --path` we can let Packer deal
with the specifics of installing a plugin from disk instead of
from a repository.

As a drive-by, update the version number in version.go to match
the latest tagged version. This version number should always
reflect the current version.
@torarnv
Copy link
Contributor Author

torarnv commented Mar 12, 2024

Like this?

@torarnv
Copy link
Contributor Author

torarnv commented Mar 12, 2024

We could adopt the entire GNUmakefile from the scaffolding repo as well of course, instead of cherry-picking changes, but that would require more updates outside of just the makefile. Not sure how much, but at least the PLUGIN_FQN part didn't work out of the box because we don't use the same format for our module declaration in go.mod

@torarnv
Copy link
Contributor Author

torarnv commented Mar 12, 2024

One missing piece here is that Packer doesn't easily allow you to run a Packer template with required_plugins against a dev/pre-release version: hashicorp/packer#12749 (comment)

Looks like Packer just got the missing bits to support this use case :) See hashicorp/packer#12749 (comment)

@edigaryev edigaryev merged commit b1299dd into cirruslabs:main Mar 15, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants